package com.reflect.demo;

import java.lang.reflect.Constructor;

/**
 * Created by thinkjoy on 2017/7/6.
 */
public class demo4 {
    public static void main(String[] args) {
        try {
            Class c=Class.forName("com.reflect.demo.Pserson");
            Constructor constructor=c.getDeclaredConstructor(String.class);
            constructor.newInstance("许伟杰");//只能创建只包含无参数的构造函数的类
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
